/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DBFunction;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

public class fOldPassword {
	public static String process(String oldPaswordJson) throws JSONException {
		JSONObject object = new JSONObject();
		object = (JSONObject) new JSONTokener(oldPaswordJson).nextValue();
		String phoneNumber = object.getString("phoneNumber");
		String oldpassword = object.getString("oldpaswword");

		String sql = "SELECT Passwords from buddytracking.user where PhoneNumber = '"
				+ phoneNumber + "' and Passwords='" + oldpassword + "'";
		ResultSet resultSet = DB.connectDB.ExecuteQuery(sql);
		String result = null;
		try {
			while (resultSet.next()) {
				result = resultSet.getString("Passwords");
			}

		} catch (SQLException ex) {

		}
		return result;
	}
}
